package creational.factory.simple.factory;

import creational.factory.simple.product.Phone;
import creational.factory.simple.product.Product;
import creational.factory.simple.product.SpicyStrips;

/**
 * @author Zhang Ziyi
 */
public class SimpleFactory {
    public Product produce(int type) {
        Product product = null;
        switch (type) {
            case 0:
                product = new SpicyStrips();
                break;
            case 1:
                product = new Phone();
                break;
            default:
                throw new IllegalArgumentException("类型非法！");
        }
        return product;
    }
}
